val input = TextIO.openIn("input.txt");

fun printInt (a:int) =
    print(Int.toString(a)^" ");

fun getInt () =
    Option.valOf (TextIO.scanStream (Int.scan StringCvt.DEC) input);
    
fun printIntList ( [] ) = ()
  | printIntList ( x::xs ) = 
    let
	val tmp = printInt(x)
    in
	printIntList(xs)
    end;

fun getIntList ( 0 ) = []
  | getIntList ( N:int) = getInt()::getIntList(N-1);

 
(*** Begin ***)
fun interleave ([], []) = []
    |interleave (a::la, []) = a :: interleave(la, [])
    |interleave ([], b::lb) = b :: interleave([], lb)
    |interleave (a::la, b::lb) = a :: b :: interleave(la, lb)


(*****End*****)

val L = getIntList(2);
val R = getIntList(6);
val O = interleave (L, R);
printIntList(O); 